package dao

import "aglaia/internal/model"

func (d *Dao) Categories(limit, offset int) ([]model.Category, int, error) {
	category := model.Category{}
	return category.List(d.engine, limit, offset)
}

func (d *Dao) CreateCategory(name string) error {
	category := model.Category{Name: name}
	return category.Create(d.engine)
}

func (d *Dao) DeleteCategory(id uint) error {
	category := model.Category{Model: model.Model{Id: id}}
	return category.Delete(d.engine)
}
